\defmodule {FrechetGen}

This class implements methods for generating random variates from the
\emph{Fr\'echet} distribution, with location parameter $\delta$, scale
 parameter $\beta > 0$, and shape parameter $\alpha > 0$, where we use
 the notation $z = (x-\delta)/\beta$. It has density
\begin{htmlonly}
\eq
    f (x) = \alpha e^{-z^{-\alpha}} /  ( \beta z^{\alpha +1} ),
              \qquad \mbox{for } x > \delta
\endeq
\end{htmlonly}
\begin{latexonly}
\[
f (x) =
 \frac{\alpha e^{-z^{-\alpha}}}  {\beta z^{\alpha +1}},
 \qquad  \mbox{for } x > \delta.
\]
\end{latexonly}
The density is  0 for $x \le \delta$.

\bigskip\hrule

\begin{code}
\begin{hide}
/*
 * Class:        FrechetGen
 * Description:  generator of random variates from the Fréchet distribution
 * Environment:  Java
 * Software:     SSJ 
 * Copyright (C) 2001  Pierre L'Ecuyer and Universite de Montreal
 * Organization: DIRO, Universite de Montreal
 * @author       
 * @since

 * SSJ is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License (GPL) as published by the
 * Free Software Foundation, either version 3 of the License, or
 * any later version.

 * SSJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * A copy of the GNU General Public License is available at
   <a href="http://www.gnu.org/licenses">GPL licence site</a>.
 */
\end{hide}
package umontreal.iro.lecuyer.randvar;\begin{hide}
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;
\end{hide}

public class FrechetGen extends RandomVariateGen \begin{hide} {
   private double delta;
   private double beta;
   private double alpha;
\end{hide}\end{code}

\subsubsection* {Constructors}
\begin{code}

   public FrechetGen (RandomStream s, double alpha) \begin{hide} {
      this (s, alpha, 1.0, 0.0);
   }\end{hide}
\end{code}
\begin{tabb}  Creates a \emph{Fr\'echet} random number generator with $\alpha =$
 \texttt{alpha}, $\beta = 1$ and $\delta = 0$ using stream \texttt{s}.
\end{tabb}
\begin{code}

   public FrechetGen (RandomStream s, double alpha, double beta,
                      double delta) \begin{hide} {
      super (s, new FrechetDist (alpha, beta, delta));
      setParams (alpha, beta, delta);
   }\end{hide}
\end{code}
\begin{tabb}  Creates a \emph{Fr\'echet} random number generator with parameters
 $\alpha$ = \texttt{alpha}, $\beta$ = \texttt{beta} and $\delta$ = \texttt{delta} using stream \texttt{s}.
\end{tabb}
\begin{code}

   public FrechetGen (RandomStream s, FrechetDist dist) \begin{hide} {
      super (s, dist);
      if (dist != null)
         setParams (dist.getAlpha(), dist.getBeta(), dist.getDelta());
   } \end{hide}
\end{code}
 \begin{tabb}  Creates a new generator for the \emph{Fr\'echet} distribution \texttt{dist}
   and stream \texttt{s}.
 \end{tabb}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\subsubsection* {Methods}
\begin{code}

   public static double nextDouble (RandomStream s, double alpha,
                                    double beta, double delta)\begin{hide} {
      return FrechetDist.inverseF (alpha, beta, delta, s.nextDouble());
   }\end{hide}
\end{code}
\begin{tabb}
   Generates a new variate from the \emph{Fr\'echet} distribution with parameters
$\alpha =$ \texttt{alpha},   $\beta = $~\texttt{beta} and $\delta =
 $~\texttt{delta} using stream \texttt{s}.
\end{tabb}
\begin{code}

   public double getAlpha()\begin{hide} {
      return alpha;
   }\end{hide}
\end{code}
  \begin{tabb} Returns the parameter $\alpha$.
  \end{tabb}
\begin{code}

   public double getBeta()\begin{hide} {
      return beta;
   }\end{hide}
\end{code}
  \begin{tabb} Returns the parameter $\beta$.
  \end{tabb}
\begin{code}

   public double getDelta()\begin{hide} {
      return delta;
   }\end{hide}
\end{code}
  \begin{tabb} Returns the parameter $\delta$.
  \end{tabb}
\begin{hide}\begin{code}

   protected void setParams (double alpha, double beta, double delta) {
     if (beta <= 0.0)
         throw new IllegalArgumentException ("beta <= 0");
      if (alpha <= 0.0)
         throw new IllegalArgumentException ("alpha <= 0");
      this.delta = delta;
      this.beta = beta;
      this.alpha = alpha;
   }
\end{code}
\begin{tabb}
   Sets the parameters  $\alpha$, $\beta$  and $\delta$ of this object.
\end{tabb}
\begin{code}
}
\end{code}
\end{hide}
